Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple Caddy reverse proxy instructions #99

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jmb
Copy link

@jmb jmb commented Mar 2, 2023

This is a first attempt at giving some instructions for using Caddy as a reverse proxy rather than nginx.

I also believe things could be improved by removing the exposure of ports and using the container names, but this is a more global choice.

Caddy could probably also serve the /images/ and /static/ endpoints directly rather than having the nginx container still running, but I haven't included this idea yet.

@mouse-reeve
Copy link
Member

Is there a particular advantage to using caddy over nginx, or is this for folks who already have caddy running? I don't know what caddy is so I'm in the dark 😄

Documentation-wise, can you add a bit of context for this section, so that it's clear that this is being presented as an alternative set of instructions for people not using nginx? I'm concerned that as is, people will think they need to take action on this section when they wouldn't need to.

@jmb
Copy link
Author

jmb commented Mar 9, 2023

I think Caddy is a good alternative to the more complicated nginx as you don't need any process to update certificates (assuming you're using LetsEncrypt) or make sure you're passing through the right headers etc. as it does it all for you. I added a guide on my web site to give an overview: https://jmb.me.uk/articles/selfhosting_with_caddy_and_docker/

It could even serve the static stuff directly so you can take out the nginx stuff altogether if you wanted (but I haven't yet put this option in my doc update).

I'll take a look and update my PR to make things clearer.

Update to Caddy instructions to make things clearer.

#### Caddy

[Caddy](https://caddyserver.com) is an alternative reverse-proxy server that is simple to use and can manage TLS certificate renewals and static file serving automatically. This guide assumes that you already have a Caddy server running and it has access to the bookwyrm docker network.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we clarify what "has access to the bookwyrm docker network" means in this context?

reverse_proxy localhost:8000
}
``
If you were to give `container_name`s to the `nginx` and `web` containers in `docker-compose.yml`, then you could comment out the `ports` sections and use the container names in place of `localhost`. This would secure the raw services from being accessible directly from the outside world.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit unclear for people who are not super familiar with docker. I think it would benefit from a code example of how one would do this in the docker-compose.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants